﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ICSharpCode.WinFormsUI.Controls
{
    public class NToolStrip : System.Windows.Forms.ToolStrip
    {
        internal string theme = "Default";       

        public NToolStrip()
        {            
            this.Stretch = true;
            this.RenderMode = ToolStripRenderMode.Professional;           
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(new SolidBrush(this.BackColor), this.ClientRectangle);
            if (RenderMode == ToolStripRenderMode.Professional)
            {
                Rectangle rect = new Rectangle(1, 1, Width - 4, Height - 4);
                e.Graphics.SetClip(rect);
            }
            base.OnPaint(e);
        }
        
        public void SetTheme(string themeName)
        {
            theme = themeName;

            switch (themeName)
            {
                case "Default":
                    NToolStripTheme.HighlightForeColor = SystemColors.ControlText;
                    NToolStripTheme.HighlightBackColor = Color.FromArgb(196, 225, 255);
                    NToolStripTheme.TextColor = SystemColors.ControlText;
                    NToolStripTheme.DisableColor = SystemColors.GrayText;
                    NToolStripTheme.BackColor = SystemColors.Window;
                    NToolStripTheme.PressedColor = Color.FromArgb(248, 248, 248);
                    NToolStripTheme.StripSeparatorColor = Color.FromArgb(214, 219, 233);
                    break;
                case "Black":
                    NToolStripTheme.HighlightForeColor = Color.White;
                    NToolStripTheme.HighlightBackColor = Color.FromArgb(080, 080, 080);
                    NToolStripTheme.TextColor = Color.FromArgb(240, 240, 240);
                    NToolStripTheme.DisableColor = Color.FromArgb(224, 224, 224);
                    NToolStripTheme.BackColor = Color.FromArgb(030, 030, 030);
                    NToolStripTheme.PressedColor = Color.FromArgb(045, 045, 048);
                    NToolStripTheme.StripSeparatorColor = Color.FromArgb(098, 098, 098);
                    break;
            }

            NToolStripTheme.Name = themeName;
        }

    }

    public struct NToolStripTheme
    {
        public static string Name { get; set; }

        public static Color TextColor { get; set; }

        public static Color BackColor { get; set; }

        public static Color HighlightBackColor { get; set; }

        public static Color HighlightForeColor { get; set; }

        public static Color DisableColor { get; set; }

        public static Color PressedColor { get; set; }

        public static Color StripSeparatorColor { get; set; }

    }

}
